package com.gwd.task.model;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.gwd.task.entity.AttachmentEntity;
import lombok.Data;

/**
 * @author zhiyongming
 * @date 2020/12/14 10:49
 */
@Data
public class AttachmentDTO {
    private Long id;
    private String code;
    private String fileName;
    private String originalFilename;
    private String tempCode;
    //标记使用
    //0: 之前已保存过的
    //1: 需要新增的
    //2: 需要删除的
    private Integer type = 0;
    //文件类型
    private Integer atType = 0;

    public AttachmentDTO() {}

    public AttachmentDTO(AttachmentEntity entity) {
        BeanUtil.copyProperties(entity, this, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
    }
}
